home *** CD-ROM | disk | FTP | other *** search
/ Aminet 3 / Aminet 3 - July 1994.iso / Aminet / util / misc / aterminfo.lha / compiler.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-12  |  2.7 KB  |  109 lines

  1.  
  2. /* This work is copyrighted. See COPYRIGHT.OLD & COPYRIGHT.NEW for   *
  3. *  details. If they are missing then this copy is in violation of    *
  4. *  the copyright conditions.                                        */
  5.  
  6. /*
  7.  *    compiler.h - Global variables and structures for the terminfo
  8.  *            compiler.
  9.  *
  10.  */
  11.  
  12. #include <stdio.h>
  13.  
  14. #ifndef TRUE
  15. #define TRUE    1
  16. #define FALSE    0
  17. #endif
  18.  
  19. #define SINGLE            /* only one terminal (actually none) */
  20.  
  21. extern char    *destination;        /* destination directory for object files */
  22.  
  23. extern long    start_time;        /* time at start of compilation */
  24. long    time();
  25.  
  26. extern FILE    *curr_fh;
  27.  
  28. extern int    curr_line;        /* current line # in input */
  29. extern long    curr_file_pos;        /* file offset of current line */
  30.  
  31. extern int    debug_level;        /* level of debugging output */
  32.  
  33. #define DEBUG(level, fmt, a1) \
  34.         if (debug_level >= level)\
  35.             fprintf(stderr, fmt, a1);
  36.  
  37. #define DEBUG0(level, str) \
  38.         if (debug_level >= level)\
  39.             fprintf(stderr, str);
  40.  
  41.     /*
  42.      *    These are the types of tokens returned by the scanner.
  43.      *    The first three are also used in the hash table of capability
  44.      *    names.  The scanner returns one of these values after loading
  45.      *    the specifics into the global structure curr_token.
  46.      *
  47.      */
  48.  
  49. #define BOOLEAN 0        /* Boolean capability */
  50. #define NUMBER 1        /* Numeric capability */
  51. #define STRING 2        /* String-valued capability */
  52. #define CANCEL 3        /* Capability to be cancelled in following tc's */
  53. #define NAMES  4        /* The names for a terminal type */
  54. #define UNDEF  5        /* Undefined */
  55.  
  56.     /*
  57.      *    The global structure in which the specific parts of a
  58.      *    scanned token are returned.
  59.      *
  60.      */
  61.  
  62. struct token
  63. {
  64.     char    *tk_name;        /* name of capability */
  65.     int    tk_valnumber;    /* value of capability (if a number) */
  66.     char    *tk_valstring;    /* value of capability (if a string) */
  67. };
  68.  
  69. extern struct token    curr_token;
  70.  
  71.     /*
  72.      *    The file comp_captab.c contains an array of these structures,
  73.      *    one per possible capability.  These are then made into a hash
  74.      *    table array of the same structures for use by the parser.
  75.      *
  76.      */
  77.  
  78. struct name_table_entry
  79. {
  80.     struct name_table_entry *nte_link;
  81.     char    *nte_name;    /* name to hash on */
  82.     int    nte_type;    /* BOOLEAN, NUMBER or STRING */
  83.     short    nte_index;    /* index of associated variable in its array */
  84. };
  85.  
  86. extern struct name_table_entry    cap_table[];
  87. extern struct name_table_entry    *cap_hash_table[];
  88.  
  89. extern int    Captabsize;
  90. extern int    Hashtabsize;
  91.  
  92. #define NOTFOUND    ((struct name_table_entry *) 0)
  93.     /*
  94.      *    Function types
  95.      *
  96.      */
  97.  
  98. struct name_table_entry    *find_entry();    /* look up entry in hash table */
  99.  
  100. char    next_char();
  101. char    trans_string();
  102.  
  103. extern void syserr_abort(const char *,...);
  104. extern void err_abort(const char *,...);
  105. extern void warning(const char *,...);
  106. extern void panic_mode(char);
  107. extern int  get_token();
  108. extern void reset_input();
  109.